from langchain.llms import OpenAI
from langchain.agents import load_tools,initialize_agent,AgentType
from langchain.chat_models import ChatOpenAI

llm = OpenAI(
    api_key='hk-mtiquv1000041663a49a34520ad3294132cbce7abf1c2ef3',
    base_url="https://api.openai-hk.com/v1"
)

tools = load_tools(['ddg-search','llm-math'],llm=llm)
agent = initialize_agent(tools,llm,agent=AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
                         max_iterations=2,
                         verbose=True,
                         return_intermediate_steps=False
                         )

print(agent.run('OpenAI开发大会召开的年份除以4，最后得到的数字'))

